﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SystemManage_AdminResetUserPassword : System.Web.UI.Page
{
    private string Code
    {
        get
        {
            return Request.QueryString["code"] != null ? Request.QueryString["code"].ToString() : "";
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Share.UserValue(0) != "admin")
        {
            Response.Write("<script>alert('无权操作此页面内容！');window.location.href='userslist.aspx'</script>");
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Share.UserValue(0) != "admin")
        {
            Response.Write("<script>alert('无权操作此页面内容！');window.location.href='userslist.aspx'</script>");
        }
        string newPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPassword.Text.Trim(), "MD5").ToString();
        if (new BLL.USERS().UpdateUserPassword(this.Code, newPassword))
        {
            Share.InsertLog("100400", "00002");
            Share.Alert(this.Page, "密码修改成功");
        }
        else
        {
            Share.Alert(this.Page, "密码修改失败");
        }
        
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("UsersList.aspx");
    }
}
